package com.aaa.phone.service.ipersonalservice.impl;

import com.aaa.phone.dao.personaldao.UpdateUserImgAndName;
import com.aaa.phone.service.ipersonalservice.IUpdateUsernameAndImage;
import com.aaa.phone.systemconst.ISystemConst;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: battery
 * @description: 更新头像和昵称
 * @author: 王璐
 * @create: 2018-12-20 11:06
 **/
@Service
public class UpdateUsernameAndImg implements IUpdateUsernameAndImage,ISystemConst {
    /**
     * 自动注入
     */
    @Autowired
    private UpdateUserImgAndName dao;

    /**
     * 更新头像和昵称
     *
     * @param img
     * @param nickname
     * @param phone
     * @return
     */
    @Override
    public int update(String img, String nickname, String phone) {
        int i = dao.update(img, nickname, phone);
        //判断是否更新成功
        if (i > ZERO) {
            //更新成功，返回100
            return SUCCESS_CODE;
        } else {
            //更新失败，返回200
            return DEFEAT_CODE;
        }
    }
}
